{* Smarty - iDaren页面公共头部 *}

<html>
<head>
	<title>{$page_title}</title>
	<meta http-equiv="content-type" content="text/html; charset=utf-8"/>

	<link rel="icon" type="image/jpg" href="/assets/favicon.jpg" />
	<link rel="stylesheet" type="text/css" href="/assets/css/reset.css" />
	<link rel="stylesheet" type="text/css" href="/assets/css/style.css" />

{literal}
	<script language="javascript">
		var BASE_HOSTPATH;

		function initVar(url) {
			BASE_HOSTPATH = url;
		}

		function cleanSearchContext() {
			var val = document.getElementById("searchContext").value;
			if (val == "输入您想了解的问题") {
				document.getElementById("searchContext").value = "";
			}
		}

		function search() {
			document.location.href = '/dr-includes/dr-page-search.php?query='+encodeURIComponent($.trim($("#query").val()));
		}

		// 当用户点击搜索框的时候，清空其初始内容
		$(document).ready(function() {
			$('#query').click(function(event) {
					$('#query').val('');
			});
		});
	</script>
{/literal}
</head>

<body onload="initVar('{$BASE_HOSTPATH}')">

<div id="global-header"></div>
<div id="container">

	<div id="header">
		<div id="top-bar">
		{* logo *}
			<div id="logo">
				<a href="{$BASE_HOSTPATH}" title="Just another clone of StackOverflow!"><img src="/assets/images/idaren.png" /></a>
			</div>
		{* 搜索 / 提问 *}
			<div id="search-ask">
				<form action="/dr-includes/dr-page-search.php" method="get">
					<input type="text" id="query" name="query" value="搜索..." />
				</form>
			</div>
		{* 用户操作 登陆 / 退出 *}
			<div id="top-nav">
				{foreach from=$content.top_navs key=key item=nav}
					<a href="{$nav.link}">{$nav.title}</a>
				{/foreach}
			</div>
		</div>
		<br class="clear" />

	{* iDaren导航菜单 *}
		<div id="global-menus">
			<div class="nav">
				<ul>
					{foreach from=$content.menus.menus key=key item=menu}
						<li>
							<a href="{$menu.link}" {if $key == $content.menus.curr}class="youarehere"{/if}>{$menu.title}</a>
						</li>
					{/foreach}
				</ul>
			</div>
			<div class="nav ask-question">
				<ul>
					<li>
						<a href="{$BASE_HOSTPATH}ask" {if 'ask' == $content.menus.curr}class="youarehere"{/if}>提问</a>
					</li>
				</ul>
			</div>
		</div>
	</div>
	<div class="clear"></div>
